package common

import (
	"beesoft.ink/application/media/app/helper/framework"
	model "beesoft.ink/application/media/app/model/category"
	service "beesoft.ink/application/media/app/service/common"
	"fmt"
	"github.com/kataras/iris/v12"
)

var Category category

type category struct{}

func (r *category) List(ctx iris.Context) {
	var req model.CategoryListReq
	if err := ctx.ReadBody(&req); err != nil {
		fmt.Println(err)
	}

	items, err := service.Category.List(ctx, &req)
	if err != nil {
		return
	}

	framework.ResponseOk(ctx, items)
}
